<h2>Pesquisar textos</h2>
<form method="post" action="<?=$this->baseUrl ?>/textos"><label>Busca:</label>
<input type="text" value="<?=$this->busca ?>" name="busca" /> Área de
Conhecimento: <select name="areas">
<option value="0">Todas</option>
<? foreach($this->areas as $areas) : ?>
	<option <?if (isset($this->area) && $this->area == $areas->id) :  ?>selected="selected"<?endif; ?> value="<?=$areas->id?>"><?=$areas->nome ?></option>
<? endforeach; ?>
</select> <input type="submit" value="procurar" /></form>
<table width="895" id="tabela_list" class="tabela_listagem">
	<thead>
		<th><a href="<?=$this->baseUrl ?>/textos/index/filtro/titulo/ordem/<?if(isset($this->ordem) && $this->ordem == "asc"):?><?=$ordem = "desc"; else:?><?=$ordem = "asc"; endif; ?>"> Título </a></th>
		<th>Áreas de conhecimento</th>
		<th><a href="<?=$this->baseUrl ?>/textos/index/filtro/data/ordem/<?if(isset($this->ordem) && $this->ordem == "asc"):?><?=$ordem = "desc"; else:?><?=$ordem = "asc"; endif; ?>"> Data </a></th>
		<? if ($this->perfil != 'professor') :?><th>postado por</th><? endif; ?>
		<th></th>
	</thead>
	<tbody>
			<?
			foreach ( $this->paginator as $texto ) :
			?>
			<tr>
			<td width="150"><a href="<?=$this->baseUrl ?>/textos/ver/id/<?=$texto->id ?>"><strong><?=$texto->titulo?></strong></a></td>
			<td width="140"><? foreach($texto->findAreasViaAreasTextosByTexto() as $a): ?>
			- <?=$a->nome ?> 
			<? endforeach; ?>
			</td>
			<td width="130"><?=$texto->data?></td>

			<? if ($this->perfil != 'professor') :?><td width="55"><?=$texto->findParentUsuarios()->nome?></td><? endif; ?>
			<td  width="80"><a href="<?=$this->baseUrl ?>/textos/ver/id/<?=$texto->id ?>">ver texto</a></td>

			</tr>
				<?
				endforeach;
				?>
				</tbody>
</table>
<br clear="all" />
<?= $this->paginator; ?>

